package com.yuw.staticdemo;

public class Vehicle {

	// 属性
	public static String vehicleName;
	private double vehicleSpeed;

	// 静态语句块
	static{
		// 在类加载到jvm执行时会进行执行，且只执行一次
		System.out.println("执行了静态语句块");
	}
	
	// 静态的方法
	public static void showMe() {
		System.out.println("This a vehicle of " + vehicleName);
		// move();// 静态的方法不能访问非静态的方法，静态的只能访问静态的；
	}

	// 行为
	public void move() {
		// showMe(); // 非静态的方法可以访问静态的方法
		System.out.println(this.vehicleName + " is moving at speed of " + this.vehicleSpeed);
	}

	public double getVehicleSpeed() {
		return vehicleSpeed;
	}

	public void setVehicleSpeed(double vehicleSpeed) {
		this.vehicleSpeed = vehicleSpeed;
	}

}
